import request from '@/utils/request'

/**
 * 获取权限列表
 */
export const getPermissionListApi = () => {
  return request({
    url: '/sys/permission'
  })
}

/**
 * 添加权限
 */
export const addPermissionApi = (data) => {
  return request({
    url: '/sys/permission',
    method: 'post',
    data
  })
}

/**
 * 删除角色
 */
export const delPermissionApi = id => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}

/**
 * 获取权限详情
 */
export const getPermissionDetailApi = id => {
  return request({
    url: `/sys/permission/${id}`
  })
}

/**
 * 编辑权限
 */
export const editPermissionApi = data => {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'put',
    data
  })
}
